
#import "UIViewController+ModalWithNavBar.h"

@implementation UIViewController (ModalWithNavBar)

-(void)presentModalWithNavBar:(UIViewController *)viewController {
    UINavigationController *wrapper = [[UINavigationController alloc] initWithRootViewController:viewController];
    
    wrapper.modalPresentationStyle = UIModalPresentationFullScreen;

    UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:@"Klar" style:UIBarButtonItemStyleDone target:self action:@selector(donePressed)];
    viewController.navigationItem.rightBarButtonItem = button;
    [self presentViewController:wrapper animated:YES completion:nil];
}

- (void)donePressed
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
